import requests

from config import BASE_URL


class LoginAPI(object):
    # 类属性：login_url:保存登录的url
    login_url = BASE_URL + '/api/sys/login'

    @classmethod
    def login2(cls, mobile, password):
        """
        # 功能：发送登陆请求
        # :param body: 发送请求的请求体
        # :return: 发送登陆请求后的响应对象
        """
        body = {
            'mobile': mobile,
            'password': password
        }
        response = requests.post(cls.login_url, json=body)

        return response

    @classmethod
    def login(cls, body):
        # 功能：发送登陆请求
        # :param body: 发送请求的请求体
        # :return: 发送登陆请求后的响应对象
        response = requests.post(cls.login_url, json=body)

        return response
